﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Project/Course/GetGridJsonD",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                { label: '课程名称', name: 'Name', width: 380, align: 'center' },
                { label: '场主姓名', name: 'PublicName', width: 200, align: 'center' },
                {
                    label: '发布时间', name: 'F_CreatorTime', width: 200, align: 'center',
                    formatter: "date", formatoptions: { srcformat: 'y-m-d h:i:s', newformat: 'y-m-d h:i:s' }
                },
                {
                    label: '课程价格', name: 'CourseNowPrice', width: 200, align: 'center'
                },
                {
                    label: '审核状态', name: 'CourseState', width: 200, align: 'center'
                }

            ],
            pager: "#gridPager",
            sortname: 'F_CreatorTime desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            debugger;
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val()},
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "添加课程类型",
            url: "/Project/Course/DraftsForm",
            width: "1000px",
            height: "600px",
            callBack: null
    });
    }
    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Form",
            title: "修改课程类型",
            url: "/Project/Course/DraftsForm?keyValue=" + keyValue,
            width: "1000px",
            height: "600px",
            callBack: null
        });
    }
    function btn_delete() {
        $.deleteForm({
            url: "/Project/Course/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Details",
            title: "查看课程类型",
            url: "/Project/Course/DraftsDetails?keyValue=" + keyValue,
            width: "1000px",
            height: "600px",
            btn: null,
        });
    }

</script>




<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新增课程</a>
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-edit" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改课程</a></li>
                <li><a id="NF-delete" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除课程</a></li>
                <li><a id="NF-Details" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看课程</a></li>
                <li class="split"></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group" style="padding-left:11px;padding-right:10px;">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="按照课程类型模糊搜索" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary active"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<style>
    table tr td {
        padding-left: 15px;
    }
</style>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
